package unit10.preserveWholeObject;

/**
 * @author v_irlwang
 * @date 2021/5/11
 */
public class Example {

    class Room {
        //某天的数据
        TempRange dayTempRange = new TempRange();
        //计划对象
        HeatingPlan plan = new HeatingPlan();

        boolean withinPlan() {
            int low = dayTempRange.getLow();
            int high = dayTempRange.getHigh();
            return plan.withinRang(low, high);
        }
    }

    class HeatingPlan {
        private TempRange range;

        boolean withinRang(int low, int high) {
            return low >= range.getLow() && high <= range.getHigh();
        }
    }

    class TempRange {
        private int low;
        private int high;

        public int getLow() {
            return low;
        }

        public int getHigh() {
            return high;
        }
    }

}
